﻿using System.Windows.Input;
using System.Windows;

namespace MDCAdminTool.Commands
{
    public class SaveCacheName : AsyncCommandBindingBase
    {
        public SaveCacheName()
        {
            Command = Application.Current.Resources["SaveCacheName"] as ICommand;
        }

        protected override void OnExecuted( object sender , ExecutedRoutedEventArgs e )
        {
            var cache = e.Parameter as MdcCache;
            if ( cache != null )
            {
                cache.SaveConfig();
                
                // TODO: 
                MainWindow.ReLoadClusterTreeView();
            }
        }
        protected override void OnCanExecute( object sender , CanExecuteRoutedEventArgs e )
        {
            e.CanExecute = true;
        }
    }
}
